<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>main</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
    <script type="text/javascript">

        $(function () {
            $.post("selectUserName",function (data,status) {
                if(status != "success"){
                    alert("服务出现问题，请稍后再试！");
                    return;
                }
                if(data == "failLogin"){
                    alert("请先进行登录！！")
                    window.location.href="index.html";
                    return;
                }
                $("#userName").html(data);
            });

            $.post("selectNodeInfoByUserId",function (data,status) {
                if(status != "success"){
                    alert("服务出现问题，请稍后再试！");
                    return;
                }
                if (data == ""){
                    $("#node").html("暂无笔记哦~");
                    return;
                }
                var json = eval('(' + data + ')')
                //console.info(json)
                var count = 1;
                var content = "\t\t<table class=\"table table-striped\">";
                for(var i in json){
                    content =  content + "<tr>\n" +
                        "\t\t\t\t<td width='10px'>"+ count +"</td>\n" +
                        "\t\t\t\t<td><a href='nodeInfoByNodeId/" + json[i].nodeId + "' style=\"font-size: 16px; color:#64854c;font-weight:bold;\"><b>" + json[i].nodeTitle + "</b></a></td>\n" +
                        "\t\t\t\t<td width='200px' align=\"right\">" + json[i].nodeCreateTime + "</td>\n" +
                        "\t\t\t</tr>\n" +
                        "\t\t\t<tr>\n" +
                        "\t\t\t\t<td></td>\n" +
                        "\t\t\t\t<td colspan=\"2\"><a href='nodeInfoByNodeId/" + json[i].nodeId + "' >" + json[i].nodeContent + "</a></td>\n" +
                        "\t\t\t</tr>";
                    count +=1;
                }
                content = content + "</table>";
                $("#node").html(content);
            });
        });
    </script>

    <style type="text/css">
        li{list-style: none; float: left;}
        a{
            cursor:pointer
        }
        p{
            padding: 0;
            margin: 0;
        }
    </style>

</head>
<body>
<div class="container-fluid">

    <a id="userName" style="position: absolute; top: 20px; right: 20px;" href="#"></a>

    <div class="row-fluid">
        <div class="clo2">
            <div class="navbar">
                <div class="navbar-inner">
                    <ul class="nav">
                        <li class="active"><a href="main.html">首页</a></li>
                        <li><a href="addNode.html">写文章</a></li>
                        <li><a href="#">资讯</a></li>
                    </ul>
                </div>
            </div>
        </div>


        <div class="span10">
            <div id="node">
            </div>
        </div>
</div>
</div>
</body>
</html>